#ifndef _ZR_GAME_INTERNAL_H_
#define _ZR_GAME_INTERNAL_H_

#include "spheres_types.h"
#include "spheres_constants.h"

// Interaction Zone definitions
#define ZONE_pX		0.8f
#define ZONE_pY		0.64f
#define ZONE_pZ		0.65f
#define ZONE_nX		-ZONE_pX
#define ZONE_nY		-ZONE_pY
#define ZONE_nZ		-ZONE_pZ

// Item location definitions

#define LOW_FUEL 0.05f
#define NORMAL_FUEL 0.07f
#define HIGH_FUEL 0.09f
#define MAX_FUEL 1.0f

#define ZR_TIMEOUT  210000
#define CONE_ANGLE	PI/15
#define GAME_AXIS POS_Y

// ZR game methods
void initZRGame();
void updateZRGame(unsigned int maneuver_time, 
				  state_vector ctrlStateMe,
				  state_vector ctrlStateOther, 
				  int ZRtimeout);
unsigned char getZRGameResult();

// item accessors
unsigned char hasRepulsor();
void setHasRepulsor(unsigned char value);
unsigned char otherHasRepulsor();
void setOtherHasRepulsor(unsigned char value);
unsigned char hasMagnet();
void setHasMagnet(unsigned char value);
unsigned char otherHasMagnet();
void setOtherHasMagnet(unsigned char value);
unsigned char hasSRepulsor();
void setHasSRepulsor(unsigned char value);
unsigned char otherHasSRepulsor();
void setOtherHasSRepulsor(unsigned char value);
unsigned char hasSMagnet();
void setHasSMagnet(unsigned char value);
unsigned char otherHasSMagnet();
void setOtherHasSMagnet(unsigned char value);
unsigned char hasShield();
void setHasShield(unsigned char value);
unsigned char otherHasShield();
void setOtherHasShield(unsigned char value);
unsigned char hasLaser();
void setHasLaser(unsigned char value);
unsigned char otherHasLaser();
void setOtherHasLaser(unsigned char value);
unsigned char hasBHG();
void setHasBHG(unsigned char value);
unsigned char otherHasBHG();
void setOtherHasBHG(unsigned char value);
unsigned char hasEMP();
void setHasEMP(unsigned char value);
unsigned char otherHasEMP();
void setOtherHasEMP(unsigned char value);
unsigned char shieldOnBHG();
void setShieldOnBHG(unsigned char value);
unsigned char shieldOnEMP();
void setShieldOnEMP(unsigned char value);
unsigned char onWeakHill();
void setOnWeakHill(unsigned char value);
unsigned char otherOnWeakHill();
void setOtherOnWeakHill(unsigned char value);
unsigned char spinningOnWeakHill();
void setSpinningOnWeakHill(unsigned char value);
unsigned char otherSpinningOnWeakHill();
void setOtherSpinningOnWeakHill(unsigned char value);
unsigned char shootingStrongHill();
void setShootingStrongHill(unsigned char value);
unsigned char otherShootingStrongHill();
void setOtherShootingStrongHill(unsigned char value);
float hillHPRemaining();
void setHillHPRemaining(float value);
unsigned char hillShieldDestroyed();
void setHillShieldDestroyed(unsigned char value);
unsigned char hillAuraDestroyed();
void setHillAuraDestroyed(unsigned char value);
unsigned char onStrongHill();
void setOnStrongHill(unsigned char value);
unsigned char otherOnStrongHill();
void setOtherOnStrongHill(unsigned char value);
unsigned char spinningOnStrongHill();
void setSpinningOnStrongHill(unsigned char value);
unsigned char otherSpinningOnStrongHill();
void setOtherSpinningOnStrongHill(unsigned char value);
float currentScore();
void setCurrentScore(float value);
float otherCurrentScore();
void setOtherCurrentScore(float value);
unsigned int fuelEmpty();
void setFuelEmpty(unsigned int value);
unsigned int otherFuelEmpty();
void setOtherFuelEmpty(unsigned int value);
float fuelRemaining();
void setFuelRemaining(float value);
unsigned int numberRepelsRemaining();
void setNumberRepelsRemaining(unsigned int value);
unsigned int numberMagnetsRemaining();
void setNumberMagnetsRemaining(unsigned int value);
unsigned int numberShieldsRemaining();
void setNumberShieldsRemaining(unsigned int value);
unsigned char firingRepulsor();
void setFiringRepulsor(unsigned char value);
unsigned char otherFiringRepulsor();
void setOtherFiringRepulsor(unsigned char value);
unsigned char firingMagnet();
void setFiringMagnet(unsigned char value);
unsigned char otherFiringMagnet();
void setOtherFiringMagnet(unsigned char value);
unsigned char firingSRepulsor();
void setFiringSRepulsor(unsigned char value);
unsigned char otherFiringSRepulsor();
void setOtherFiringSRepulsor(unsigned char value);
unsigned char firingSMagnet();
void setFiringSMagnet(unsigned char value);
unsigned char otherFiringSMagnet();
void setOtherFiringSMagnet(unsigned char value);
unsigned char losingShield();
void setLosingShield(unsigned char value);
unsigned char otherLosingShield();
void setOtherLosingShield(unsigned char value);
unsigned char firingLaser();
void setFiringLaser(unsigned char value);
unsigned char otherFiringLaser();
void setOtherFiringLaser(unsigned char value);
unsigned char firingBHG();
void setFiringBHG(unsigned char value);
unsigned char otherFiringBHG();
void setOtherFiringBHG(unsigned char value);
unsigned char firingEMP();
void setFiringEMP(unsigned char value);
unsigned char otherFiringEMP();
void setOtherFiringEMP(unsigned char value);
unsigned short userSetRepelForce();
void setUserSetRepelForce(unsigned short value);
unsigned short otherSetRepelForce();
void setOtherSetRepelForce(unsigned short value);
const float repelForce();
void setRepelForce(const float value);
const float repelDrainRate();
void setRepelDrainRate(const float value);
unsigned char repelDisabled();
void setRepelDisabled(unsigned char value);

//etc

// item use methods

/**
 * WARNING, can only be called once per control cycle
 */
unsigned short getUserRepelForce();
void setOtherRepelForce(unsigned short repelForce);

/**
 * WARNING, can only be called once per control cycle
 */
void ZRGetRepelForce(float refVector[3], float *ctrlForces, state_vector ctrlStateMe, state_vector ctrlStateOther);

// fuel methods
void setMaxFuel(float fuel);
float getMaxFuel();
int getFuelFlag();
void setOtherFuelFlag(int fuelDone);
int getOtherFuelFlag();
// Sets the maximum fuel use to a custom value as a percentage of a total SPHERES tank (e.g. for flat floor testing)
void setMaxFuelUsePercent(float percent);
//Returns the tank count for the maximum fuel usage 
int getMaxFuelUse();

// score checking
float getCurrentScore();
float getOtherCurrentScore();

// boundary limits
void enforceBoundaryLimits(state_vector ctrlState, float ctrlControl[6]);


#endif

